package com.zzq.service.impl;

import com.zzq.domain.dto.SmileProductDTO;
import com.zzq.domain.entity.SmileProduct;
import com.zzq.domain.search.ProductSearchParamet;
import com.zzq.result.SmileResult;
import com.zzq.service.ClientProductService;
import com.zzq.service.SmileProductService;
import com.zzq.util.BeanCopyUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClientProductServiceImpl implements ClientProductService {
    @Autowired
    SmileProductService productService;

    @Override
    public SmileResult getProductInfoById(Long productId) {
        return SmileResult.sucess("查询成功",productService.getById(productId));
    }

    @Override
    public SmileResult getProductInfoList(ProductSearchParamet searchParamet) {
        List<SmileProduct> list = productService.list();
        List<SmileProductDTO> smileProductDTOS = BeanCopyUtils.copyBeanList(list, SmileProductDTO.class);
        return SmileResult.sucess("获取成功",smileProductDTOS);
    }


}
